package b1.scenes.fight
{
	import b1.net.*;
	
	import com.greensock.*;
	
	import flash.display.Sprite;
	import flash.text.*;

	public class Wind extends Sprite
	{
		private var speed:Number;
		private var windSpeedMax:int;
		private var windTopBar:Sprite;
		private var grade:int;
		
		public function Wind()
		{
			super();
			var windTxt:TextField = new TextField();
			windTxt.text = "风速";
			windTxt.x = 0;
			windTxt.y = 25;
			addChild(windTxt);
			randomSpeed();
		}
		
		public function randomSpeed():void
		{
			var r:Number = Math.random() * 11;
			this.grade = Math.floor(r) - 5;
			speed = grade * windSpeedMax / 5;
		}
		
		//设置最大风速
		public function setMaxSpeed(windSpeedMax:int):void
		{
			this.windSpeedMax = windSpeedMax;
		}
		
		//返回当前风速
		public function getWindSpeed():int
		{
			return this.speed;
		}
		
		//返回风速等级
		public function getWindSpeedGrade():int
		{
			return this.grade;
		}
		
		//设置风速等级-5,-4,-3,-2,-1,0,1,2,3,4,5
		public function setWindSpeedGrade(windSpeedGrade:int):void
		{
			this.grade = windSpeedGrade;
			this.speed = grade * windSpeedMax / 5;
		}
		
		//风速停止
		public function stop():void
		{
			this.grade = 0;
		}
	}
}